package client.data;

import java.io.Serializable;
import java.security.KeyPair;
import java.security.PrivateKey;


/**
 *	A data structure that contains the user's identity
 *  contains his id , password , and his keys
 *  the keys are his digital signature key (signing key and verification key)
 *  and his message encryption keys (encryption key and decryprion key) 
 */

public class Identity implements Serializable{
	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * users unique id received from the server
	 */
	private int _id;
	@SuppressWarnings("unused")
	private String _password;
	private KeyPair _digitalSignature; //to sign/verify user messages
	private KeyPair _myKey;       //to decrypt/encrypt messages while communicating with the user
	/**
	 * Creates an instance of Identity
	 * @param id user id	
	 * @param password user password (encrypted)
	 * @param digitalSignature user's digital signature keys
	 * @param myKey	user's encryption/decryption keys
	 */
	public Identity(int id, String password , KeyPair digitalSignature, KeyPair myKey){
		_id = id;
		_password = password;
		_digitalSignature = digitalSignature;
		_myKey = myKey;
	}
	/**
	 * 
	 * @return the client's id
	 */
	public int getId(){
		return _id;
	}
	/**
	 * 
	 * @return the client's private decryption key
	 */
	public PrivateKey getDecryptionKey() {
		return _myKey.getPrivate();
	}
	/**
	 * 
	 * @return the client's private signing key
	 */
	public PrivateKey getSignatureKey() {
		return _digitalSignature.getPrivate();
	}

}
